#include "QQNavigationView.h"

QQNavigationView::QQNavigationView(QWidget* parent)
	: QListView(parent)
{
	this->setObjectName("QQNavigationView");
	this->setStyleSheet(
		"QQNavigationView{background-color: transparent;border:0px;}"
		"QQNavigationView::item{border:none;}");
	this->setAutoScroll(false);
	this->setFocusPolicy(Qt::NoFocus);
	this->setVerticalScrollBar(new ElaScrollBar(this));
	this->setHorizontalScrollBar(new ElaScrollBar(this));
	this->setSelectionMode(QAbstractItemView::NoSelection);
	this->setMouseTracking(true);
	this->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
	this->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
	this->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
	this->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
}

QQNavigationView::~QQNavigationView()
{
}

void QQNavigationView::mousePressEvent(QMouseEvent* event)
{
	emit mousePress(indexAt(event->pos()));
	return QListView::mousePressEvent(event);
}

void QQNavigationView::mouseReleaseEvent(QMouseEvent* event)
{
	emit mouseRelease(indexAt(event->pos()));
	return QListView::mouseReleaseEvent(event);
}

void QQNavigationView::mouseDoubleClickEvent(QMouseEvent* event)
{
	emit mouseDoubleClick(indexAt(event->pos()));
	return QListView::mouseDoubleClickEvent(event);
}
